package com.heima.admin.controller;

import com.heima.admin.anno.Log;
import com.heima.api.wemedia.WemediaFeign;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.admin.dtos.ChannelPageDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
@Slf4j
@Api(tags = "频道相关接口")
@RequiredArgsConstructor
public class AdminChannelController {
    private final WemediaFeign wemediaFeign;

    @Log
    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable String id) {
        return wemediaFeign.deleteChannel(id);
    }

    @PostMapping("list")
    public ResponseResult queryPageChannel(@RequestBody ChannelPageDto dto) {
        return wemediaFeign.queryPageChannel(dto);
    }

    @PostMapping("/update")
    @Log
    public ResponseResult modifyChannel(@RequestBody ChannelDto dto) {
        return wemediaFeign.modifyChannel(dto);
    }

    @PostMapping("/save")
    @Log
    public ResponseResult saveChannel(@RequestBody ChannelDto dto) {
        return wemediaFeign.addChannel(dto);
    }
}
